const BasicModel = require('./BasicModel');
module.exports = class extends BasicModel {
  async addannounceAction(params) {
    const id = think.uuid('v4');
    params.data.id = id;
    await this.model(params.model).add(params.data);
    const obj = {id: id};
    return obj;
  }
  async getAction(params) {
    const data = await this.model(params.model).where(params.data).find();
    const textdata = await this.model('richtext').where({relation_id: params.id}).find();
    data.textdata = textdata;
    return data;
  }
  async saveAction(params) {
    const insertdata = params.data;
    insertdata.status = '0';
    const data = await this.model(params.model).where(params.data.id).update(insertdata);
    return data;
  }
  async releaseAction(params) {
    const insertdata = params.data;
    insertdata.status = '1';
    const data = await this.model(params.model).where(params.data.id).update(insertdata);
    return data;
  }
};
